package main

import "fmt"

// 条件语句
func main() {

	//if条件语句
	var a int = 10
	if a < 20 {
		fmt.Printf("a小于20")
	} else {
		fmt.Printf("a 不小于 20")
	}

	//switch条件语句
	/*定义局部变量*/
	var grade string = "B"
	var marks int = 90
	switch marks {
	case 90:
		grade = "A"
	case 80:
		grade = "B"
	case 50, 60, 70:
		grade = "C"
	default:
		grade = "D"
	}

	switch {
	case grade == "A":
		fmt.Printf("优秀！\n")
	case grade == "B":
		fmt.Printf("良好！\n")
	case grade == "D":
		fmt.Printf("及格！\n")
	case grade == "F":
		fmt.Printf("不及格！\n")
	default:
		fmt.Printf("差\n")
	}
	fmt.Printf("你的等级是 %s\n", grade)

}
